import json


def getJson(func: object) -> object:
    """
    获取json请求 request.json_dict
    @param func:
    @return:
    """

    def inner(view, request, *args, **kwargs):
        try:
            json_str = request.body
            json_dict = json.loads(json_str)
        except:
            json_dict = {}
        request.json_dict = json_dict
        res = func(view, request, *args, **kwargs)
        return res

    return inner
